/**
 * Copyright 2009 the original author or authors.
 *
 * Licensed under the GPL License, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.gnu.org/licenses/lgpl-3.0.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.guardianapis.api.http;

import java.io.InputStream;

public class GuardianHttpResponse {

	/*******************************************************************************
	 * Properties
	 *******************************************************************************/
	
	private boolean success;
	private InputStream response;
	private String errorMessage;
	private Throwable errorCause;
	
	/*******************************************************************************
	 * Constructors
	 *******************************************************************************/

	public GuardianHttpResponse(String pErrorMessage) {
		this(pErrorMessage, (Throwable) null);
	}
	
	public GuardianHttpResponse(String pErrorMessage, Throwable pErrorCause) {
		this.success = false;
		this.errorMessage = pErrorMessage;
		this.errorCause = pErrorCause;
	}

	public GuardianHttpResponse(InputStream pInputStream) {
		this.success = true;
		this.response = pInputStream;
	}

	/*******************************************************************************
	 * Getters / Setters
	 *******************************************************************************/

	public boolean isSuccess() {
		return this.success;
	}
	
	public InputStream getResponse() {
		return this.response;
	}
	
	public String getErrorMessage() {
		return this.errorMessage;
	}
	
	public Throwable getErrorCause() {
		return this.errorCause;
	}
}
